import Mock from 'mockjs'
import { MockList } from 'graphql-tools'

const { Random } = Mock

const getRandomPath = (min, max) => {
  const deep = Random.integer(min, max)
  let r = ''
  for (let i = 0; i < deep; i += 1) {
    r += `/${Random.cname()}`
  }
  return r
}

export default {
  member: () => ({
    parentId: (root, args, context, info) => info.variableValues.parentId,
    path: getRandomPath(1, 5),
    type: Random.pick(['team', 'member', 'member', 'member', 'member']),
    name: Random.cname(),
    bio: Random.ctitle(),
    teams: Random.integer(0, 10),
    members: Random.integer(0, 50),
    createAt: Random.date(),
    avatar: `http://xingjing.dudc.org/a${Random.integer(13, 24)}.jpg`,
    role: Random.pick(['member', 'member', 'member', 'member', 'admin']),
  }),
}
